package tech.aistar.service.impl;

import org.apache.ibatis.session.SqlSession;
import tech.aistar.mapper.UserMapper;
import tech.aistar.model.entity.User;
import tech.aistar.service.IUserService;
import tech.aistar.util.MyBatisUtil;

/**
 * 本类用来演示:
 *
 * @author: success
 * @date: 2021/4/23 1:36 下午
 */
public class UserServiceImpl implements IUserService {
    @Override
    public User login(String username) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        User user = userMapper.getByUsername(username);
        MyBatisUtil.closeSqlSession(sqlSession);
        return user;
    }
}
